<template>
  <div>
    <button @click="fetchInfo">获取信息</button>
    <p v-if="info">{{ info }}</p>
  </div>
</template>

<script setup lang="ts">
import axios from 'axios'
import { ref } from 'vue'

const info = ref('')

const fetchInfo = async () => {
  try {
    const response = await axios.get('http://localhost:8080/info', {
      withCredentials: true // 允许携带 Cookie
    })
    info.value = response.data
  } catch (error) {
    console.error('获取信息失败:', error)
  }
}
</script>
